inspector: Add a switch for the layout debug flag
authorMatthias Clasen <mclasen@redhat.com>
Fri, 11 Mar 2016 05:17:37 +0000 (00:17 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Fri, 11 Mar 2016 05:22:36 +0000 (00:22 -0500)
gtk/inspector/visual.c
gtk/inspector/visual.ui

index ff2467b795be41b3e09950b80ff4d3ec2b287c90..2f6a64f987d92d2c1c633d8741907126656813b8 100644 (file)
@@ -55,6 +55,7 @@ struct _GtkInspectorVisualPrivate
   GtkWidget *rendering_mode_combo;
   GtkWidget *updates_switch;
   GtkWidget *baselines_switch;
+  GtkWidget *layout_switch;
   GtkWidget *touchscreen_switch;
 
   GtkWidget *gl_box;
@@ -164,6 +165,22 @@ baselines_activate (GtkSwitch *sw)
   redraw_everything ();
 }
 
+static void
+layout_activate (GtkSwitch *sw)
+{
+  guint flags;
+
+  flags = gtk_get_debug_flags ();
+
+  if (gtk_switch_get_active (sw))
+    flags |= GTK_DEBUG_LAYOUT;
+  else
+    flags &= ~GTK_DEBUG_LAYOUT;
+
+  gtk_set_debug_flags (flags);
+  redraw_everything ();
+}
+
 static void
 pixelcache_activate (GtkSwitch *sw)
 {
@@ -726,6 +743,7 @@ gtk_inspector_visual_class_init (GtkInspectorVisualClass *klass)
   gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, updates_switch);
   gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, direction_combo);
   gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, baselines_switch);
+  gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, layout_switch);
   gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, theme_combo);
   gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, dark_switch);
   gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, cursor_combo);
@@ -749,6 +767,7 @@ gtk_inspector_visual_class_init (GtkInspectorVisualClass *klass)
   gtk_widget_class_bind_template_callback (widget_class, direction_changed);
   gtk_widget_class_bind_template_callback (widget_class, rendering_mode_changed);
   gtk_widget_class_bind_template_callback (widget_class, baselines_activate);
+  gtk_widget_class_bind_template_callback (widget_class, layout_activate);
   gtk_widget_class_bind_template_callback (widget_class, pixelcache_activate);
   gtk_widget_class_bind_template_callback (widget_class, widget_resize_activate);
   gtk_widget_class_bind_template_callback (widget_class, software_gl_activate);
index 6e62934400e0a3fab1d1b15d646a4a64d2e4ff59..1942fa453232dc612bfe29ef46068508cf9b6d40 100644 (file)
                     </child>
                   </object>
                 </child>
+                <child>
+                  <object class="GtkListBoxRow">
+                    <property name="visible">True</property>
+                    <property name="activatable">False</property>
+                    <child>
+                      <object class="GtkBox">
+                        <property name="visible">True</property>
+                        <property name="orientation">horizontal</property>
+                        <property name="margin">10</property>
+                        <property name="spacing">40</property>
+                        <child>
+                          <object class="GtkLabel" id="layout_label">
+                            <property name="visible">True</property>
+                            <property name="label" translatable="yes">Show Layout Borders</property>
+                            <property name="halign">start</property>
+                            <property name="valign">baseline</property>
+                            <property name="xalign">0.0</property>
+                          </object>
+                        </child>
+                        <child>
+                          <object class="GtkSwitch" id="layout_switch">
+                            <property name="visible">True</property>
+                            <property name="halign">end</property>
+                            <property name="valign">baseline</property>
+                            <signal name="notify::active" handler="layout_activate"/>
+                          </object>
+                          <packing>
+                            <property name="expand">True</property>
+                          </packing>
+                        </child>
+                      </object>
+                    </child>
+                  </object>
+                </child>
                 <child>
                   <object class="GtkListBoxRow">
                     <property name="visible">True</property>
       <widget name="rendering_mode_label"/>
       <widget name="updates_label"/>
       <widget name="baselines_label"/>
+      <widget name="layout_label"/>
       <widget name="pixelcache_label"/>
       <widget name="touchscreen_label"/>
       <widget name="gl_label"/>